package com.jrx.anytxn.transaction.mapper.ext;

import com.jrx.anytxn.transaction.entity.TlPaymentAllocationLog;
import org.apache.ibatis.annotations.Param;


import java.util.Date;
import java.util.List;

/**
 * @author mac
 */
public interface ExtTlPaymentAllocationLogMapper {


    /**
     * 批量插入还款流水分配信息
     *
     * @param paymentAllocationLogs 还款流水分配list
     * @return int
     * @author zhenghaopu
     * date: 2019/9/9 10:13
     */
    int batchInsertSelective(List<TlPaymentAllocationLog> paymentAllocationLogs);

    /**
     * 根据还款对象查询客户还款分配流水历史列表信息
     * customerId 与 tenantId 必传
     *
     * @param tlPaymentAllocationLog 还款查询对象
     * @return 还款分配流水列表
     */
    List<TlPaymentAllocationLog> selectListByCondition(TlPaymentAllocationLog tlPaymentAllocationLog);

    /**
     * 根据还款流水获取09交易账户
     *
     * @param loanId
     * @param seqNo
     * @param customerId
     * @param tenantId
     * @return
     */
    List<TlPaymentAllocationLog> findCustLog(String loanId, String seqNo, String customerId, String tenantId);


    /**
     * 根据还款流水获取09交易账户
     *
     * @param seqNo
     * @param tenantId
     * @return
     */
    List<TlPaymentAllocationLog> selectBySeqNoAndTenantId(@Param("seqNo") String seqNo,
                                                          @Param("tenantId") String tenantId);

    /**
     * 根据订单号获取09交易账户
     *
     * @param loanId
     * @param tenantId
     * @return
     */
    List<TlPaymentAllocationLog> selectByLoanIdAndTenantId(@Param("loanId") String loanId,
                                                          @Param("tenantId") String tenantId);

    /**
     * 查询还款分配记录
     *
     * @param seqNo
     * @param customerId
     * @param tenantId
     * @return
     */
    List<TlPaymentAllocationLog> findAllocationLogs(String seqNo, String customerId, String tenantId);

    /**
     * 根据账户id查询还款分配
     *
     * @param accountId 账户id
     * @param tenantId  租户id
     * @return TlPaymentAllocationLog
     */
    TlPaymentAllocationLog selectByAccountIdAndTenantId(@Param("accountId") String accountId, @Param("tenantId") String tenantId);

    /**
     * 查询还款分配流水
     * @param loanId
     * @param customerId
     * @param tenantId
     * @param accountType
     * @return
     */
    List<TlPaymentAllocationLog> selectByLoanIdDesc(String loanId, String customerId, String tenantId,String accountType);


    /**
     * 根据关联账户类型和交易流水号获取09交易账户
     * @param connectAccountType 关联账户类型
     * @param seqNo 交易流水号
     * @return
     */
    List<TlPaymentAllocationLog> selectByConnectAccountTypeAndSeqNo(String connectAccountType, String seqNo);


    List<TlPaymentAllocationLog> selectAll09(String customerId, String tenantId,String accountType);

    List<TlPaymentAllocationLog> selectAll09WithProducts(String customerId, String tenantId,String accountType,List<String> productIds);


    List<TlPaymentAllocationLog> selectListByLoanId(@Param("tenantId")String tenantId, @Param("customerId")String customerId, @Param("loanId")String loanId,
                                                    @Param("accountType")String account_type, @Param("txnCodes")List<String> txnCodes);

    List<TlPaymentAllocationLog> selectByLoanIdAll09WithProducts(@Param("customerId")String customerId,@Param("tenantId") String tenantId,@Param("accountType")String accountType,@Param("loanId") String loanId,@Param("productIds")List<String> productIds);

    TlPaymentAllocationLog selectByLoanIdAndConnectAccountType(@Param("connectAccountType")String connectAccountType,@Param("billingTenor") String billingTenor,@Param("loanId")String loanId,@Param("tenantId")String tenantId);
}